﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PccCommonForC;
using bs_ShowRoom;

namespace ShowRoom.pub.control
{
    public partial class AjaxJquery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;
            Response.ContentType = "text/plain";
            ProcessPage(Request.QueryString["type"]);
            Response.End();
        }
        private void ProcessPage(string type)
        {
            if (type == null)
            {
                return;
            }
            if (type.ToLower() == "inspoweruser")
            {
                Response.Write(savedata_kh());
            }

        }

        private string savedata_kh()
        {

            string strCallback = "";
            try
            {               

                strCallback = "123456";
                string mn_id_d=Request.QueryString["mn_id_d"];
                string user_id=Request.QueryString["user_id"];
                string mn_id=Request.QueryString["mn_id"];
                string chk_view=Request.QueryString["chk_view"];
                string chk_add=Request.QueryString["chk_add"];
                string chk_edit=Request.QueryString["chk_edit"];
                string chk_del=Request.QueryString["chk_del"];
                string myType = Request.QueryString["Typek"];

                string strReturn = fnInsUpdPowerUser( mn_id_d, user_id, mn_id, chk_view, chk_add, chk_edit, chk_del, myType);
                

                strCallback = "GTP" + strReturn;


            }
            catch { strCallback = ""; }

            return strCallback;//error
        }
        private string fnInsUpdPowerUser(string mn_id_d, string user_id, string mn_id, string chk_view, string chk_add, string chk_edit, string chk_del, string myType)
        {
            PccMsg myMsg = new PccMsg();
            myMsg.CreateFirstNode("mn_id_d", mn_id_d);
            myMsg.CreateFirstNode("user_id", user_id);
            myMsg.CreateFirstNode("mn_id", mn_id);
            myMsg.CreateFirstNode("chk_view", chk_view);
            myMsg.CreateFirstNode("chk_add", chk_add);
            myMsg.CreateFirstNode("chk_edit", chk_edit);
            myMsg.CreateFirstNode("chk_del", chk_del);
            myMsg.CreateFirstNode("Type", myType);

            bs_menu mybs = new bs_menu(ConfigurationManager.ConnectionStrings["ShowRoomConnectionString"].ToString());

            string strXML = myMsg.GetXmlStr;
            string strReturn = mybs.DoReturnStr("INSUPDPOWERUSER", strXML, "");
            myMsg.LoadXml(strReturn);
            strReturn = myMsg.Query("Err").Trim();
            return strReturn;
            //*****************************************************************************
        }
    }
}